import{
    createRouter,
    createWebHashHistory
} from 'vue-router'

import Index from '~/pages/index.vue'
import Login from '~/pages/login.vue'
import NotFound from '~/pages/404.vue'

const routes = [{
    path: '/',
    component: Index
},
{
    path: '/login',
    component: Login
},
{ 
    // 所有不匹配的路径跳转404.vue(NotFound)页面
    path: '/:pathMatch(.*)*', 
    name: 'NotFound', 
    component: NotFound 
}]

const router = createRouter({

    history: createWebHashHistory(),
    // routes : routes 但是键值对名称相同，就省略一部分
    routes
})

export default router

